﻿namespace Project.Core.Config.Common.Lang {
    /// <summary>
	/// 返回结果实体类
	/// </summary>
    public class Result {
        /// <summary>
        /// 状态码
        /// </summary>
        public int Code { get; set; }
        /// <summary>
        /// 信息
        /// </summary>
        public string Msg { get; set; }
        /// <summary>
        /// 数据
        /// </summary>
        public object Data { get; set; }

        public static Result Succ(object data) {
            return Succ(200, "操作成功", data);
        }

        public static Result Succ(int code, string msg, object data) {
            Result r = new Result();
            r.Code = code;
            r.Msg = msg;
            r.Data = data;
            return r;
        }

        public static Result Fail(string msg) {
            return Fail(400, msg, null);
        }

        public static Result Fail(int code, string msg, object data) {
            Result r = new Result();
            r.Code = code;
            r.Msg = msg;
            r.Data = data;
            return r;
        }

    }
}
